import request from '@/utils/request'

// 查询销售订单列表
export function listOrder(query) {
  return request({
    url: '/system/saleOrder/list',
    method: 'get',
    params: query
  })
}

// 查询销售订单详细
export function getOrder(id) {
  return request({
    url: '/system/saleOrder/' + id,
    method: 'get'
  })
}
// 订单产品明细
export function getOrderdetail(id) {
  return request({
    url: '/system/saleOrder/partMsg/' + id,
    method: 'get'
  })
}
// 订单操作明细
export function getcz(id) {
  return request({
    url: '/system/saleOrder/orderMsg_get/' + id,
    method: 'get'
  })
}

// 新增销售订单
export function addOrder(data) {
  return request({
    url: '/system/saleOrder',
    method: 'post',
    data: data
  })
}

// 修改销售订单
export function updateOrder(data) {
  return request({
    url: '/system/saleOrder',
    method: 'put',
    data: data
  })
}

// 删除销售订单
export function delOrder(id) {
  return request({
    url: '/system/saleOrder/' + id,
    method: 'delete'
  })
}
// 新增报价单
export function addquotation(data) {
  return request({
    url: '/system/saleOrder/saleOrder_write',
    method: 'post',
    data: data
  })
}
// 新增报价单订单行的选择产品赋值
export function addorderzz(id) {
  return request({
    url: '/system/saleOrder/saleOrderPart_get/'+id,
    method: 'get'
  })
}
// 新增报价单订单行完整
export function quotationsub(query) {
  return request({
    url: '/system/saleOrder',
    method: 'post',
    data:query
  })
}
// 删除报价单订单行
export function delorderzz(id) {
  return request({
    url: '/system/saleOrder/saleOrderPart_delete/'+id+'/t',
    method: 'get'
  })
}
// 修改报价单订单行
export function editorderzz(id) {
  return request({
    url: '/system/saleOrder/saleOrderPart_info/'+id+'/t',
    method: 'get'
  })
}
// 编辑订单时修改报价单订单行
export function editorderzz1(id) {
  return request({
    url: '/system/saleOrder/saleOrderPart_info/'+id+'/f',
    method: 'get'
  })
}

// 修改报价单订单行提交
export function editorderzzsub(data) {
  return request({
    url: '/system/saleOrder/saleOrderPart_update',
    method: 'put',
    data:data
  })
}
// 编辑订单时的删除报价单订单行
export function delorderzz1(id) {
  return request({
    url: '/system/saleOrder/saleOrderPart_delete/'+id+'/f',
    method: 'get'
  })
}
// 销售报价单 新增 放弃
export function cancelsale() {
  return request({
    url: '/system/saleOrder/orderUpdate_abandon',
    method: 'get'
  })
}
// 取消销售订单状态
export function cancelState(id) {
  return request({
    url: '/system/saleOrder/orderCancel/'+id,
    method: 'get'
  })
}
// 确认销售订单状态
export function sureState(id) {
  return request({
    url: '/system/saleOrder/orderConfirm/'+id,
    method: 'get'
  })
}

export function sOrderReview(orderId) {
  return request({
    url: '/system/print/ok?orderId='+orderId,
    method: 'get',
    responseType: 'blob',
   
  })
}